{layout '../Layout/layout.latte'}
{block headTitle}待加入{/block}
{block private_js}
    <script>
        $(".buttons-tab .tab-link a").on("click", function (e) {
            e.stopPropagation();
        });

        var ajaxGet = function (url, preloader) {
            $.ajax({
                url: url,
                type: "GET",
                dataType: "json",
                success: function (res) {
                    if (res.status === "n") {
                        $.toast(res.info);
                        return;
                    }
                    $.showPreloader(preloader);
                    setTimeout(function () {
                        location.href = res.data;
                    }, 1000)
                }
            });
        };

        $(function () {
            $(".item-after [data-url]").on("click", function () {

                var url = $(this).attr("data-url");
                var buttons1 = [{
                    text: '请选择',
                    label: true
                }, {
                    text: '同意加入',
                    bold: true,
                    onClick: function () {
                        ajaxGet(url);
                    }
                }, {
                    text: '拒绝加入',
                    color: 'danger',
                    onClick: function () {
                        ajaxGet(url + "?reject=1");
                    }
                }];
                var buttons2 = [{
                    text: '取消',
                    bg: 'danger'
                }];
                var groups = [buttons1, buttons2];
                $.actions(groups);
            });

        })
    </script>
{/block}

{block private_css}
    <style>
        .item-after div{
            font-size:14px; border:1px solid #3797ff; width:60px; text-align:center;
            height:30px; line-height:28px;
            color:#3797ff;
        }

        .item-after div.main{
            color:#fff;
            background:#3797ff;
        }

        .item-after {
            max-height:unset !important;
        }

    </style>
{/block}
{block content}
    {include "./tabs.latte"}
    <div class="content-block-title" style="font-size: .875rem;text-align: center;margin: 30px 0">{$count}个团队/企业邀请你加入</div>
    <div class="list-block">
        <ul>
            {foreach $lists as $k=>$item}
                <li class="item-content">
                    <div class="item-inner">
                        <div class="item-title">{$item['c_names']}</div>
                        <div class="item-after">
                            <div data-name="加入企业[{$item['c_names']}]" data-url="{url('mobileConsoles_company_inviteagree',"id=".$item['m_id'])}">处理</div>
                        </div>
                    </div>
                </li>
            {/foreach}
        </ul>
    </div>
{/block}
